package com.ruoyi.message.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.message.mapper.LeaveMessageMapper;
import com.ruoyi.message.domain.LeaveMessage;
import com.ruoyi.message.service.ILeaveMessageService;

/**
 * 留言管理Service业务层处理
 * 
 * @author chen
 * @date 2023-12-13
 */
@Service
public class LeaveMessageServiceImpl implements ILeaveMessageService 
{
    @Autowired
    private LeaveMessageMapper leaveMessageMapper;

    /**
     * 查询留言管理
     * 
     * @param id 留言管理主键
     * @return 留言管理
     */
    @Override
    public LeaveMessage selectLeaveMessageById(Long id)
    {
        return leaveMessageMapper.selectLeaveMessageById(id);
    }

    /**
     * 查询留言管理列表
     * 
     * @param leaveMessage 留言管理
     * @return 留言管理
     */
    @Override
    public List<LeaveMessage> selectLeaveMessageList(LeaveMessage leaveMessage)
    {
        return leaveMessageMapper.selectLeaveMessageList(leaveMessage);
    }

    /**
     * 新增留言管理
     * 
     * @param leaveMessage 留言管理
     * @return 结果
     */
    @Override
    public int insertLeaveMessage(LeaveMessage leaveMessage)
    {
        leaveMessage.setCreateTime(DateUtils.getNowDate());
        return leaveMessageMapper.insertLeaveMessage(leaveMessage);
    }

    /**
     * 修改留言管理
     * 
     * @param leaveMessage 留言管理
     * @return 结果
     */
    @Override
    public int updateLeaveMessage(LeaveMessage leaveMessage)
    {
        leaveMessage.setUpdateTime(DateUtils.getNowDate());
        return leaveMessageMapper.updateLeaveMessage(leaveMessage);
    }

    /**
     * 批量删除留言管理
     * 
     * @param ids 需要删除的留言管理主键
     * @return 结果
     */
    @Override
    public int deleteLeaveMessageByIds(Long[] ids)
    {
        return leaveMessageMapper.deleteLeaveMessageByIds(ids);
    }

    /**
     * 删除留言管理信息
     * 
     * @param id 留言管理主键
     * @return 结果
     */
    @Override
    public int deleteLeaveMessageById(Long id)
    {
        return leaveMessageMapper.deleteLeaveMessageById(id);
    }

    @Override
    public int examineLeaveMessage(LeaveMessage leaveMessage) {

        return leaveMessageMapper.updateLeaveMessage(leaveMessage);
    }
}
